<?php

/**
 * Subclass for performing query and update operations on the 'language' table.
 *
 * 
 *
 * @package lib.model
 */ 
class LanguagePeer extends BaseLanguagePeer
{
  public static function getCulturesArray()
  {
  	$cultures = array();
  	
  	foreach (LanguagePeer::doSelect(new Criteria()) as $language)
  	{
  	  $cultures[] = $language->getCulture();
  	}
  	
  	return $cultures;
  }
  
  public static function retrieveByCulture($culture)
  {
  	$c = new Criteria();
  	$c->add(LanguagePeer::CULTURE, $culture);
  	
  	return LanguagePeer::doSelectOne($c);
  }
  
  public static function retrieveByLang($lang)
  {
  	$c = new Criteria();
  	$c->add(LanguagePeer::CULTURE, $lang.'%', Criteria::LIKE);
  	
  	return LanguagePeer::doSelectOne($c);
  }
  
  public static function retrieveAll()
  {
  	$c = new Criteria();
  	$c->addDescendingOrderByColumn(LanguagePeer::DIR);
  	$c->addDescendingOrderByColumn(LanguagePeer::CULTURE);
  	
  	return self::doSelect($c);
  }
}
